#include "serialportreader.h"
#include <QDebug>

SerialPortReader::SerialPortReader(QObject *parent) : QObject(parent) {
    serialPort = new QSerialPort(this);

    serialPort->setPortName("/dev/ttyUSB0"); // 修改为你实际使用的串口号

    serialPort->setBaudRate(QSerialPort::Baud9600);
    serialPort->setDataBits(QSerialPort::Data8);
    serialPort->setParity(QSerialPort::NoParity);
    serialPort->setStopBits(QSerialPort::OneStop);
    serialPort->setFlowControl(QSerialPort::NoFlowControl);

    if (!serialPort->open(QIODevice::ReadOnly)) {
        qDebug() << "Failed to open port" << serialPort->portName() << ", error:" << serialPort->errorString();
        return;
    }

    qDebug() << "Serial port opened.";



}
void SerialPortReader::startReading() {

}


